package com.neusoft.kq.demos.controller;
import com.neusoft.kq.demos.R;
import com.neusoft.kq.demos.entity.His;
import com.neusoft.kq.demos.entity.Order;
import com.neusoft.kq.demos.entity.User;
import com.neusoft.kq.demos.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@RequestMapping("/api/order")
public class OrderConrtroller {
    @Autowired
    private OrderService orderService;
    @GetMapping("/list")
    public R selectOrderList(Order order){
        List<Order> list=orderService.selectList(order);
        return R.success(list);
    }
    @PostMapping("/addOrder")
    public  R addOrder(Order order){
        orderService.addOrder(order);
        return R.success("添加成功");
    }

    @PostMapping("/updateOrder")
    public R updateOrder(Order order){
        orderService.updateOrder(order);
        return R.success("修改成功");
    }


    @DeleteMapping("/delOrder")
    public R delOrder(int order_id){
        orderService.delOrder(order_id);
        return R.success("删除成功");
    }
}